Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for API Registry and enable data residency #374

Merged
merged 17 commits into from
Jan 22, 2024
Merged

Conversation

srinandan
Copy link
Collaborator

No description provided.

cmd/apis/bundlecrtapis.go Show resolved Hide resolved
cmd/apis/depapi.go Show resolved Hide resolved
cmd/apis/ghcrtapis.go Show resolved Hide resolved
cmd/apis/listdeploy.go Show resolved Hide resolved
cmd/appgroups/createkey.go Show resolved Hide resolved
cmd/sharedflows/bundlecrtsf.go Show resolved Hide resolved
cmd/sharedflows/depsf.go Show resolved Hide resolved
cmd/sharedflows/ghcrtsf.go Show resolved Hide resolved
cmd/sharedflows/listdeploy.go Show resolved Hide resolved
cmd/sharedflows/listsf.go Show resolved Hide resolved
Copy link
Collaborator

@kurtkanaskie kurtkanaskie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I think I figured out how to navigate the APIs, versions to get to the spec, but we are missing getContent for the spec

gorun registry apis versions artifacts specs 
Manage specs for an API version in Apigee Registry

Usage:
  apigeecli registry apis versions artifacts specs [command]

Available Commands:
  list        List all specs for an API version

The equivalent of this API

curlx https://apigeeregistry.googleapis.com/v1/projects/apigeex-mint-kurt/locations/global/apis/ui-api-id-1/versions/v1/specs/petstore-30yaml:getContents

I think we need:
gorun registry apis versions specs get content
Along with
gorun registry apis versions specs create
gorun registry apis versions specs get
gorun registry apis versions specs delete
gorun registry apis versions specs update

I don't think it should be under "artifacts" as it is now
apigeecli registry apis versions artifacts specs
just versions, artifacts are something else.
apigeecli registry apis versions specs -h

@srinandan
Copy link
Collaborator Author

The correct command for what you are trying is:

apigeecli registry apis versions artifacts specs get --help
Get the spec details for an API version in Apigee Registry

Usage:
  apigeecli registry apis versions artifacts specs get [flags]

Flags:
      --api-name string      API Name
      --api-version string   API Version
  -c, --content              If set to true, returns artifact contents
  -h, --help                 help for get
  -n, --name string          Name of the Spec

Copy link
Collaborator

@kurtkanaskie kurtkanaskie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the spec content should be associated in the context of an artifact.
Structure of APIs is:
projects.locations
projects.locations.apis
projects.locations.apis.artifacts # Related, Dependencies
projects.locations.apis.deployments
projects.locations.apis.deployments.artifacts
projects.locations.apis.versions
projects.locations.apis.versions.artifacts
projects.locations.apis.versions.specs:getContents # OAS
projects.locations.apis.versions.specs.artifacts
projects.locations.artifacts

This API returns spec content, notice there's no artifact in the path.
curl https://apigeeregistry.googleapis.com/v1/projects/apigeex-mint-kurt/locations/global/apis/ui-api-id-1/versions/v1/specs/petstore-30yaml:getContents

I think this apigeecli
gorun registry apis versions artifacts specs get --org=$ORG --name=petstore-30yaml --api-version=v1 --api-name=ui-api-id-1 --content=true

should not have artifacts, just
gorun registry apis versions specs get --org=$ORG --name=petstore-30yaml --api-version=v1 --api-name=ui-api-id-1 --content=true

cmd/registry/apis/versions/specs/getspec.go Show resolved Hide resolved
@srinandan srinandan linked an issue Jan 15, 2024 that may be closed by this pull request
@kurtkanaskie
Copy link
Collaborator

Getting content from an API spec version should output to the named filename

gorun registry apis versions specs list --org=$ORG --api-name=ui-api-id-1 --api-version=v1
{
  "apiSpecs": [
    {
      "name": "projects/apigeex-mint-kurt/locations/global/apis/ui-api-id-1/versions/v1/specs/petstore-30yaml",
      "filename": "petstore-3.0.yaml",
      "revisionId": "86d6e250",
      "createTime": "2024-01-04T20:51:39.885140Z",
      "revisionCreateTime": "2024-01-04T20:51:39.885140Z",
      "revisionUpdateTime": "2024-01-04T20:51:39.885140Z",
      "mimeType": "application/x.openapi",
      "sizeBytes": 21273,
      "hash": "479e90bfc004ca0386996f0ecda217810e955d3ed4d84a56a2f6e098a158215a"
    }
  ]
}

gorun registry apis versions specs get --org=$ORG --name=petstore-30yaml --api-version=v1 --api-name=ui-api-id-1 --content

Creates file: petstore-30yaml.txt but should use filename: petstore-3.0.yaml

@kurtkanaskie
Copy link
Collaborator

LGTM!

@srinandan srinandan merged commit bac0e9c into main Jan 22, 2024
5 checks passed
@srinandan srinandan deleted the registry branch January 22, 2024 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants